package com.mantru.iotpot.Begin;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.InputFilter;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.mantru.iotpot.ApplicationClass;
import com.mantru.iotpot.R;
import com.mantru.iotpot.Util.ToastUtils;

import java.util.ArrayList;
import java.util.List;

public class ManufacturerSetActivity extends AppCompatActivity {

    private ImageView back;
    private TextView pot;
    private TextView rail;
    private TextView mechanicalArm;
    private TextView throwFood;
    private ConstraintLayout pot_layout;
    private TextView pot_up;
    private TextView pot_down;
    private TextView pot_change_pot_clockwise;
    private TextView pot_change_pot_counterclockwise;
    private ConstraintLayout rail_layout;
    private TextView rail_forward;
    private TextView rail_backward;
    private ConstraintLayout mechanical_arm_layout;
    private TextView directionUp;
    private TextView directionDown;
    private EditText editText;
    private TextView angleSet;
    private TextView switchRun;
    private TextView switchStop;
    private TextView change_pot_clockwise;
    private TextView change_pot_counterclockwise;
    private ConstraintLayout throw_layout;
    private TextView throw_up;
    private TextView throw_down;
    private String type = "";
    private final List<String> directionList = new ArrayList<>();
    private final List<Float> angleList = new ArrayList<>();
    private ApplicationClass ac;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_manufacture_set);
        ac = ((ApplicationClass)getApplication());
        initView();//set my control here
        initState();//设置初始状态
        setControlAction();//set what the control do
    }

    private void initView(){
        back = findViewById(R.id.manufacture_back);
        pot = findViewById(R.id.manufacture_pot);
        rail = findViewById(R.id.manufacture_rail);
        mechanicalArm = findViewById(R.id.manufacture_mechanical_arm);
        throwFood = findViewById(R.id.manufacture_throw);
        pot_layout = findViewById(R.id.pot_layout);
        pot_up = findViewById(R.id.pot_up);
        pot_down = findViewById(R.id.pot_down);
        pot_change_pot_clockwise = findViewById(R.id.pot_change_pot_clockwise);
        pot_change_pot_counterclockwise = findViewById(R.id.pot_change_pot_counterclockwise);
        rail_layout = findViewById(R.id.rail_layout);
        rail_forward = findViewById(R.id.rail_forward);
        rail_backward = findViewById(R.id.rail_backward);
        mechanical_arm_layout = findViewById(R.id.mechanical_arm_layout);
        directionUp = findViewById(R.id.dish_direction_up);
        directionDown = findViewById(R.id.dish_direction_down);
        editText = findViewById(R.id.dish_angle_edittext);
        angleSet = findViewById(R.id.dish_angle_set);
        switchRun = findViewById(R.id.dish_switch_run);
        switchStop = findViewById(R.id.dish_switch_stop);
        change_pot_clockwise = findViewById(R.id.change_pot_clockwise);
        change_pot_counterclockwise = findViewById(R.id.change_pot_counterclockwise);
        throw_layout = findViewById(R.id.throw_layout);
        throw_up = findViewById(R.id.throw_up);
        throw_down = findViewById(R.id.throw_down);
    }

    //设置初始状态
    private void initState(){
        //上方按钮状态
        pot.setBackgroundResource(R.drawable.radius8_1151e4);
        rail.setBackgroundResource(R.drawable.radius8_16ffffff);
        mechanicalArm.setBackgroundResource(R.drawable.radius8_16ffffff);
        throwFood.setBackgroundResource(R.drawable.radius8_16ffffff);
        type = "锅";

        //下方列表
        for ( int i = 0; i < 4; i++ ){
            directionList.add("向下");
            angleList.add(0.0F);
        }
        //下面按钮的状态要根据这里的选择做出初始化
        setButtonListState(0);
    }

    private void setControlAction(){
        //返回按钮
        back.setOnClickListener(v -> finish());

        //按钮-锅
        pot.setOnClickListener(v -> {
            pot.setBackgroundResource(R.drawable.radius8_1151e4);
            rail.setBackgroundResource(R.drawable.radius8_16ffffff);
            mechanicalArm.setBackgroundResource(R.drawable.radius8_16ffffff);
            throwFood.setBackgroundResource(R.drawable.radius8_16ffffff);
            type = "锅";
            //下面按钮的状态要根据这里的选择做出初始化
            setButtonListState(0);
        });

        //按钮-导轨
        rail.setOnClickListener(v -> {
            pot.setBackgroundResource(R.drawable.radius8_16ffffff);
            rail.setBackgroundResource(R.drawable.radius8_1151e4);
            mechanicalArm.setBackgroundResource(R.drawable.radius8_16ffffff);
            throwFood.setBackgroundResource(R.drawable.radius8_16ffffff);
            type = "导轨";
            //下面按钮的状态要根据这里的选择做出初始化
            setButtonListState(1);
        });

        //按钮-机械臂
        mechanicalArm.setOnClickListener(v -> {
            pot.setBackgroundResource(R.drawable.radius8_16ffffff);
            rail.setBackgroundResource(R.drawable.radius8_16ffffff);
            mechanicalArm.setBackgroundResource(R.drawable.radius8_1151e4);
            throwFood.setBackgroundResource(R.drawable.radius8_16ffffff);
            type = "机械臂";
            //下面按钮的状态要根据这里的选择做出初始化
            setButtonListState(2);
        });

        //按钮-投菜
        throwFood.setOnClickListener(v -> {
            pot.setBackgroundResource(R.drawable.radius8_16ffffff);
            rail.setBackgroundResource(R.drawable.radius8_16ffffff);
            mechanicalArm.setBackgroundResource(R.drawable.radius8_16ffffff);
            throwFood.setBackgroundResource(R.drawable.radius8_1151e4);
            type = "投菜";
            //下面按钮的状态要根据这里的选择做出初始化
            setButtonListState(3);
        });

        //按钮—锅往上
        pot_up.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image345(1, 3);
                    ac.SaveLog("用户按下锅往上按钮，event:1,type:3");
                    pot_up.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image345(2, 3);
                    ac.SaveLog("用户松开锅往上按钮，event:2,type:3");
                    pot_up.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    return true;

                }
                return false;
            }
        });

        //按钮—锅往下
        pot_down.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image345(1, 4);
                    ac.SaveLog("用户按下锅往下按钮，event:1,type:4");
                    pot_down.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image345(2, 4);
                    ac.SaveLog("用户松开锅往下按钮，event:2,type:4");
                    pot_down.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮—转锅顺时针
        pot_change_pot_clockwise.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image345(1, 5);
                    ac.SaveLog("用户按下转锅顺时针按钮，event:1,type:5");
                    pot_change_pot_clockwise.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image345(2, 5);
                    ac.SaveLog("用户松开转锅顺时针按钮，event:2,type:5");
                    pot_change_pot_clockwise.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-转锅逆时针
        pot_change_pot_counterclockwise.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image345(1, 6);
                    ac.SaveLog("用户按下转锅逆时针按钮，event:1,type:6");
                    pot_change_pot_counterclockwise.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image345(2, 6);
                    ac.SaveLog("用户松开转锅逆时针按钮，event:2,type:6");
                    pot_change_pot_counterclockwise.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-导轨-向前
        rail_forward.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image2(1, 1);
                    ac.SaveLog("用户按下向前按钮，event:1,type:1");
                    rail_forward.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image2(2, 1);
                    ac.SaveLog("用户松开向前按钮，event:2,type:1");
                    rail_forward.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-导轨-向后
        rail_backward.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image2(1, 2);
                    ac.SaveLog("用户按下向后按钮，event:1,type:2");
                    rail_backward.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image2(2, 2);
                    ac.SaveLog("用户松开向后按钮，event:2,type:2");
                    rail_backward.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-方向-向上
        directionUp.setOnClickListener(v -> {
            directionUp.setBackgroundResource(R.drawable.radius8_1151e4);
            directionDown.setBackgroundResource(R.drawable.radius8_16ffffff);
            switch (type){
                case "锅":
                    directionList.set(0, "向上");
                    ac.Device_SendCommand_Motor_Direction(1, 1);//0向下、1向上
                    break;
                case "导轨":
                    directionList.set(1, "向上");
                    ac.Device_SendCommand_Motor_Direction(2, 1);//0向下、1向上
                    break;
                case "机械臂":
                    directionList.set(2, "向上");
                    ac.Device_SendCommand_Motor_Direction(3, 1);//0向下、1向上
                    break;
                case "投菜":
                    directionList.set(3, "向上");
                    ac.Device_SendCommand_Motor_Direction(4, 1);//0向下、1向上
                    break;
            }
        });

        //按钮-方向-向下
        directionDown.setOnClickListener(v -> {
            directionUp.setBackgroundResource(R.drawable.radius8_16ffffff);
            directionDown.setBackgroundResource(R.drawable.radius8_1151e4);
            switch (type){
                case "锅":
                    directionList.set(0, "向下");
                    ac.Device_SendCommand_Motor_Direction(1, 0);//0向下、1向上
                    break;
                case "导轨":
                    directionList.set(1, "向下");
                    ac.Device_SendCommand_Motor_Direction(2, 0);//0向下、1向上
                    break;
                case "机械臂":
                    directionList.set(2, "向下");
                    ac.Device_SendCommand_Motor_Direction(3, 0);//0向下、1向上
                    break;
                case "投菜":
                    directionList.set(3, "向下");
                    ac.Device_SendCommand_Motor_Direction(4, 0);//0向下、1向上
                    break;
            }
        });

        //监听输入框焦点
        editText.setOnFocusChangeListener((v, hasFocus) -> {
            if (hasFocus) {
                // 当获得焦点时清空内容
                editText.setText("");
            }
        });

        //限制输入框规则，最多只能有一位小数
        editText.setFilters(new InputFilter[]{
                (source, start, end, dest, dstart, dend) -> {
                    String result = dest.toString();
                    String newChar = source.subSequence(start, end).toString();

                    // 检查是否已经有一个小数点
                    if (result.contains(".") && newChar.contains(".")) {
                        return ""; // 如果已经有一个小数点，不允许输入新的小数点
                    }

                    // 检查小数点后最多只能输入一个数字
                    if (result.contains(".")) {
                        String[] parts = result.split("\\.");
                        if (parts.length > 1 && !parts[1].isEmpty()) {
                            return ""; // 如果小数点后已经有数字，不允许继续输入
                        }
                    }

                    // 检查输入是否为小数点并且前面没有数字
                    if (newChar.equals(".") && result.isEmpty()) {
                        return "0."; // 如果输入的是小数点并且前面没有数字，自动补全为 "0."
                    }

                    return null; // 允许输入
                }
        });

        //监听输入框回车键
        editText.setOnEditorActionListener((v, actionId, event) -> {
            // 检查是否是按下 Enter 键或者完成操作
            if ((event != null && (event.getAction() == KeyEvent.ACTION_DOWN) && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
                    || actionId == EditorInfo.IME_ACTION_DONE
                    || actionId == EditorInfo.IME_ACTION_NEXT
                    || actionId == EditorInfo.IME_ACTION_SEND) {
                String edittextString = editText.getText().toString().trim();
                if ( edittextString.isEmpty() ){
                    edittextString = "0";
                }
                float angleSet = Float.parseFloat(edittextString);
                if ( angleSet > 360F ){
                    ToastUtils.show(ManufacturerSetActivity.this, "请输入一个小于360度的角度");
                    return true;
                }
                switch (type){
                    case "锅":
                        angleList.set(0, angleSet);
                        ac.Device_SendCommand_Motor_Angle(1, angleSet);//1位小数点，值范围0-360
                        break;
                    case "导轨":
                        angleList.set(1, angleSet);
                        ac.Device_SendCommand_Motor_Angle(2, angleSet);//1位小数点，值范围0-360
                        break;
                    case "机械臂":
                        angleList.set(2, angleSet);
                        ac.Device_SendCommand_Motor_Angle(3, angleSet);//1位小数点，值范围0-360
                        break;
                    case "投菜":
                        angleList.set(3, angleSet);
                        ac.Device_SendCommand_Motor_Angle(4, angleSet);//1位小数点，值范围0-360
                        break;
                }
                return true;
            }
            return false;
        });

        //按钮-设置
        angleSet.setOnClickListener(v -> {
            String edittextString = editText.getText().toString().trim();
            if ( edittextString.isEmpty() ){
                edittextString = "0";
            }
            float angleSet = Float.parseFloat(edittextString);
            if ( angleSet > 360F ){
                ToastUtils.show(ManufacturerSetActivity.this, "请输入一个小于360度的角度");
                return;
            }
            switch (type){
                case "锅":
                    angleList.set(0, angleSet);
                    ac.Device_SendCommand_Motor_Angle(1, angleSet);//1位小数点，值范围0-360
                    break;
                case "导轨":
                    angleList.set(1, angleSet);
                    ac.Device_SendCommand_Motor_Angle(2, angleSet);//1位小数点，值范围0-360
                    break;
                case "机械臂":
                    angleList.set(2, angleSet);
                    ac.Device_SendCommand_Motor_Angle(3, angleSet);//1位小数点，值范围0-360
                    break;
                case "投菜":
                    angleList.set(3, angleSet);
                    ac.Device_SendCommand_Motor_Angle(4, angleSet);//1位小数点，值范围0-360
                    break;
            }
        });

        //按钮-运行
        switchRun.setOnClickListener(v -> {
            switch (type){
                case "锅":
                    ac.Device_SendCommand_Motor_Control(1, 1);//1运行、3急刹
                    break;
                case "导轨":
                    ac.Device_SendCommand_Motor_Control(2, 1);//1运行、3急刹
                    break;
                case "机械臂":
                    ac.Device_SendCommand_Motor_Control(3, 1);//1运行、3急刹
                    break;
                case "投菜":
                    ac.Device_SendCommand_Motor_Control(4, 1);//1运行、3急刹
                    break;
            }
        });

        //按钮-急刹
        switchStop.setOnClickListener(v -> {
            switch (type){
                case "锅":
                    ac.Device_SendCommand_Motor_Control(1, 3);//1运行、3急刹
                    break;
                case "导轨":
                    ac.Device_SendCommand_Motor_Control(2, 3);//1运行、3急刹
                    break;
                case "机械臂":
                    ac.Device_SendCommand_Motor_Control(3, 3);//1运行、3急刹
                    break;
                case "投菜":
                    ac.Device_SendCommand_Motor_Control(4, 3);//1运行、3急刹
                    break;
            }
        });

        //按钮-机械臂-转锅顺时针
        change_pot_clockwise.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image345(1, 5);
                    ac.SaveLog("用户按下转锅顺时针按钮，event:1,type:5");
                    change_pot_clockwise.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image345(2, 5);
                    ac.SaveLog("用户松开转锅顺时针按钮，event:2,type:5");
                    change_pot_clockwise.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-机械臂-转锅逆时针
        change_pot_counterclockwise.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image345(1, 6);
                    ac.SaveLog("用户按下转锅逆时针按钮，event:1,type:6");
                    change_pot_counterclockwise.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image345(2, 6);
                    ac.SaveLog("用户松开转锅逆时针按钮，event:2,type:6");
                    change_pot_counterclockwise.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-投菜-向上
        throw_up.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image1(1, 1);
                    ac.SaveLog("用户按下向上按钮，event:1,type:1");
                    throw_up.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image1(2, 1);
                    ac.SaveLog("用户松开向上按钮，event:2,type:1");
                    throw_up.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });

        //按钮-投菜-向下
        throw_down.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    ac.Device_SendCommand_HandCheck_Image1(1, 2);
                    ac.SaveLog("用户按下向下按钮，event:1,type:2");
                    throw_down.setBackgroundResource(R.drawable.button11);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                    ac.Device_SendCommand_HandCheck_Image1(2, 2);
                    ac.SaveLog("用户松开向下按钮，event:2,type:2");
                    throw_down.setBackgroundResource(R.drawable.button13);
                    return true;
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
                    // 忽略移动事件，不执行任何操作
                    return true;
                }
                return false;
            }
        });
    }

    @SuppressLint("SetTextI18n")
    //设置UI状态
    private void setButtonListState(int index){
        pot_layout.setVisibility(View.GONE);
        mechanical_arm_layout.setVisibility(View.GONE);
        rail_layout.setVisibility(View.GONE);
        throw_layout.setVisibility(View.GONE);
        //修改后，根据状态展示控件
        switch ( type ){
            case "锅":
                pot_layout.setVisibility(View.VISIBLE);
                break;
            case "导轨":
                rail_layout.setVisibility(View.VISIBLE);
                break;
            case "机械臂":
                mechanical_arm_layout.setVisibility(View.VISIBLE);

                if ( directionList.get(index).equals("向上") ){
                    directionUp.setBackgroundResource(R.drawable.radius8_1151e4);
                    directionDown.setBackgroundResource(R.drawable.radius8_16ffffff);
                } else {
                    directionUp.setBackgroundResource(R.drawable.radius8_16ffffff);
                    directionDown.setBackgroundResource(R.drawable.radius8_1151e4);
                }
                editText.setText(angleList.get(index).toString());
                break;
            case "投菜":
                throw_layout.setVisibility(View.VISIBLE);
                break;
        }
    }
}
